package cz.data.domain.market.model.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
public class ApiChangeMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    public static final String RELEASE = "1";
    public static final String CANCEL = "2";

    public static final String DATA_API = "1";
    public static final String TABLE_API = "2";

    @ApiModelProperty(value = "消息类型", notes = "1=dataApi,2=tableApi")
    private String type;
    @ApiModelProperty(value = "API主键")
    private String id;
    @ApiModelProperty(value = "状态", notes = "1:发布 2:撤销")
    private String status;


    public static ApiChangeMessage fromDataApi(String id, String status) {
        ApiChangeMessage message = new ApiChangeMessage();
        message.setType(DATA_API);
        message.setId(id);
        message.setStatus(status);
        return message;
    }

    public static ApiChangeMessage fromTableApi(String id, String status) {
        ApiChangeMessage message = new ApiChangeMessage();
        message.setType(TABLE_API);
        message.setId(id);
        message.setStatus(status);
        return message;
    }
}
